home *** CD-ROM | disk | FTP | other *** search
- /*
- From elgin@claudia.spectral.com (Jim Elgin)
- */
-
- /* supply "etime" fortran routine
-
- NAME
- etime - return elapsed execution time
-
- SYNOPSIS
- REAL function etime (tarray)
- REAL tarray(2)
-
- DESCRIPTION
- This routine returns elapsed runtime in seconds for the calling
- process.
-
- The argument array returns user time in the first element and system
- time in the second element. The function value is the sum of user and
- system time.
-
- The resolution of all timing is 1/CLK_TCK seconds, where CLK_TCK is
- processor dependent.
- */
-
- float etime_(tarray)
- float *tarray;
- {
- #include <unistd.h>
- #include <sys/times.h>
- struct tms buf;
- float t1, t2, den, tot;
-
- times(&buf);
- t1 = buf.tms_utime;
- t2 = buf.tms_stime;
- den = sysconf(_SC_CLK_TCK);
- *tarray = t1/den;
- *(tarray+1) = t2/den;
- tot = *tarray + *(tarray+1);
- return tot;
- }
-